"use strict";

/*
 * MikoPBX - free phone system for small business
 * Copyright © 2017-2023 Alexey Portnov and Nikolay Beketov
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program.
 * If not, see <https://www.gnu.org/licenses/>.
 */

/* global globalRootUrl, globalTranslate, Form, PbxApi, clockWorker */

/**
 * Object for managing time settings.
 *
 * @module timeSettings
 */
var timeSettings = {
  /**
   * jQuery object for the form.
   * @type {jQuery}
   */
  $formObj: $('#time-settings-form'),

  /**
   * Validation rules for the form fields before submission.
   *
   * @type {object}
   */
  validateRules: {
    CurrentDateTime: {
      depends: 'PBXManualTimeSettings',
      identifier: 'ManualDateTime',
      rules: [{
        type: 'empty',
        prompt: globalTranslate.ts_ValidateDateTime
      }]
    }
  },

  /**
   * Initializes the time settings.
   */
  initialize: function initialize() {
    $('#PBXTimezone').dropdown({
      fullTextSearch: true
    });
    $('#time-settings-form .checkbox').checkbox({
      onChange: function onChange() {
        timeSettings.toggleDisabledFieldClass();
      }
    });
    timeSettings.initializeForm();
    timeSettings.toggleDisabledFieldClass();
  },

  /**
   * Toggles the disabled field class based on the selected time setting.
   */
  toggleDisabledFieldClass: function toggleDisabledFieldClass() {
    if (timeSettings.$formObj.form('get value', 'PBXManualTimeSettings') === 'on') {
      $('#SetDateTimeBlock').removeClass('disabled');
      $('#SetNtpServerBlock').addClass('disabled');
    } else {
      $('#SetNtpServerBlock').removeClass('disabled');
      $('#SetDateTimeBlock').addClass('disabled');
      clockWorker.restartWorker();
    }
  },

  /**
   * Callback function to be called before the form is sent
   * @param {Object} settings - The current settings of the form
   * @returns {Object} - The updated settings of the form
   */
  cbBeforeSendForm: function cbBeforeSendForm(settings) {
    var result = settings;
    result.data = timeSettings.$formObj.form('get values');
    return result;
  },

  /**
   * Callback function to be called after the form has been sent.
   * @param {Object} response - The response from the server after the form is sent
   */
  cbAfterSendForm: function cbAfterSendForm(response) {
    if (timeSettings.$formObj.form('get value', 'PBXManualTimeSettings') === 'on') {
      var manualDate = timeSettings.$formObj.form('get value', 'ManualDateTime');
      var timestamp = Date.parse("".concat(manualDate)) / 1000;
      var userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
      PbxApi.UpdateDateTime({
        timestamp: timestamp,
        userTimeZone: userTimeZone
      });
    }
  },

  /**
   * Initialize the form with custom settings
   */
  initializeForm: function initializeForm() {
    Form.$formObj = timeSettings.$formObj;
    Form.url = "".concat(globalRootUrl, "time-settings/save"); // Form submission URL

    Form.validateRules = timeSettings.validateRules; // Form validation rules

    Form.cbBeforeSendForm = timeSettings.cbBeforeSendForm; // Callback before form is sent

    Form.cbAfterSendForm = timeSettings.cbAfterSendForm; // Callback after form is sent

    Form.initialize();
  }
}; // When the document is ready, initialize the time settings form

$(document).ready(function () {
  timeSettings.initialize();
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9UaW1lU2V0dGluZ3MvdGltZS1zZXR0aW5ncy1tb2RpZnkuanMiXSwibmFtZXMiOlsidGltZVNldHRpbmdzIiwiJGZvcm1PYmoiLCIkIiwidmFsaWRhdGVSdWxlcyIsIkN1cnJlbnREYXRlVGltZSIsImRlcGVuZHMiLCJpZGVudGlmaWVyIiwicnVsZXMiLCJ0eXBlIiwicHJvbXB0IiwiZ2xvYmFsVHJhbnNsYXRlIiwidHNfVmFsaWRhdGVEYXRlVGltZSIsImluaXRpYWxpemUiLCJkcm9wZG93biIsImZ1bGxUZXh0U2VhcmNoIiwiY2hlY2tib3giLCJvbkNoYW5nZSIsInRvZ2dsZURpc2FibGVkRmllbGRDbGFzcyIsImluaXRpYWxpemVG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XG4gICAgICogQHR5cGUge29iamVjdH1cbiAgICAgKi9cbiAgICB2YWxpZGF0ZVJ1bGVzOiB7XG4gICAgICAgIEN1cnJlbnREYXRlVGltZToge1xuICAgICAgICAgICAgZGVwZW5kczogJ1BCWE1hbnVhbFRpbWVTZXR0aW5ncycsXG4gICAgICAgICAgICBpZGVudGlmaWVyOiAnTWFudWFsRGF0ZVRpbWUnLFxuICAgICAgICAgICAgcnVsZXM6IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIHR5cGU6ICdlbXB0eScsXG4gICAgICAgICAgICAgICAgICAgIHByb21wdDogZ2xvYmFsVHJhbnNsYXRlLnRzX1ZhbGlkYXRlRGF0ZVRpbWUsXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIF0sXG4gICAgICAgIH0sXG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEluaXRpYWxpemVzIHRoZSB0aW1lIHNldHRpbmdzLlxuICAgICAqL1xuICAgIGluaXRpYWxpemUoKSB7XG4gICAgICAgICQoJyNQQlhUaW1lem9uZScpLmRyb3Bkb3duKHtcbiAgICAgICAgICAgIGZ1bGxUZXh0U2VhcmNoOiB0cnVlLFxuICAgICAgICB9KTtcblxuICAgICAgICAkKCcjdGltZS1zZXR0aW5ncy1mb3JtIC5jaGVja2JveCcpLmNoZWNrYm94KHtcbiAgICAgICAgICAgIG9uQ2hhbmdlKCkge1xuICAgICAgICAgICAgICAgIHRpbWVTZXR0aW5ncy50b2dnbGVEaXNhYmxlZEZpZWxkQ2xhc3MoKTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgIH0pO1xuICAgICAgICB0aW1lU2V0dGluZ3MuaW5pdGlhbGl6ZUZvcm0oKTtcbiAgICAgICAgdGltZVNldHRpbmdzLnRvZ2dsZURpc2FibGVkRmllbGRDbGFzcygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBUb2dnbGVzIHRoZSBkaXNhYmxlZCBmaWVsZCBj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